package com.kotlin.mvpdemo.ui.users.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.kotlin.mvpdemo.ui.users.UserListFragment;

/**
 * author : fang.zhang
 * e-mail : initzf@126.com
 * date   : 2020/6/6
 * desc   :
 */
public class UserFragmentAdapter extends FragmentStateAdapter {

    String[] mTitles = {"个人", "关注", "喜欢"};

    public UserFragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
        super(fragmentManager, lifecycle);

    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return UserListFragment.newInstance(position);
    }

    @Override
    public int getItemCount() {
        return mTitles.length;
    }


    public String getTitle(int position) {
        return mTitles[position];
    }

}
